<% layout("/layouts/micro.html",{background:"true"}){ %>
	<div class="childrenBody">
     <div class="layui-tab-content">
		<form id="inputForm" action="${ctx}/sys/menu/save" method="post" class="layui-form">
			<input type="hidden" name="id" value="${menu.id}"/>
			<div class="layui-row layui-col-space10">
				<div class="layui-col-md12">
					<div class="layui-card">
						<div class="layui-card-body">
							<div class="layui-form-item">
								<label class="layui-form-label">上级菜单:</label>
								<div class="layui-input-inline">
									<#treeselect id="menu" name="parent.id" value="${menu.parent.id!}" labelName="parent.name" labelValue="${menu.parent.name!}"
									title="菜单" url="/sys/menu/treeData" extId="${menu.id}" />
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">名称:</label>
								<div class="layui-input-inline">
									<input type="text" name="name" value="${menu.name}" htmlEscape="false" maxlength="50" class="layui-input" lay-verify="required"/>
								</div>
								<div class="layui-form-mid "><font color="red">*</font> </div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">链接:</label>
								<div class="layui-input-inline">
									<input type="text" name="href" value="${menu.href}" htmlEscape="false" maxlength="2000" class="layui-input"/>
								</div>
								<div class="layui-form-mid layui-word-aux">点击菜单跳转的页面</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">目标:</label>
								<div class="layui-input-inline">
									<input type="text" name="target" value="${menu.target}" htmlEscape="false" maxlength="10" class="layui-input"/>
								</div>
								<div class="layui-form-mid layui-word-aux">链接地址打开的目标窗口，默认：mainFrame</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">图标:</label>
								<div class="layui-input-block">
									<#iconselect id="icon" name="icon" value="${menu.icon}"/>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">排序:</label>
								<div class="layui-input-inline">
									<input type="text" name="sort" value="${menu.sort}" htmlEscape="false" maxlength="50" class="layui-input" lay-verify="required"/>
								</div>
								<div class="layui-form-mid layui-word-aux"><font color="red">*</font>排列顺序，升序</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">可见:</label>
								<div class="layui-input-inline" >
									<#radio name="isShow" items="${@DictUtils.getDictList('show_hide')}" value="${menu.isShow }"/>
								</div>
								<div class="layui-form-mid layui-word-aux"><font color="red">*</font>该菜单或操作是否显示到系统菜单中</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">权限标识:</label>
								<div class="layui-input-inline">
									<input type="text" name="permission" value="${menu.permission}" htmlEscape="false" maxlength="100" class="layui-input"/>
								</div>
								<div class="layui-form-mid layui-word-aux">控制器中定义的权限标识，如：@RequiresPermissions("权限标识")</div>
							</div>
							<div class="layui-form-item layui-form-text">
								<label class="layui-form-label">备注:</label>
								<div class="layui-input-block">
									<textarea name="remarks" htmlEscape="false" rows="3" maxlength="200" class="layui-textarea">${menu.remarks}</textarea>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="layui-form-item layui-hide">
				<div class="layui-input-block">
					<%if(shiro.hasPermission("sys:menu:edit")){%>
					<button class="layui-btn" type="submit" lay-filter="addData" id="addData" lay-submit>保 存</button>
					<%}%>
				</div>
			</div>
		</form>
	</div>
</div>
<script>
    layui.use(['form', 'laydate'], function() {
        var form = layui.form, laydate = layui.laydate;
        form.render();
        form.on("submit(addData)",function(data){
            var index = top.layer.msg('数据提交中，请稍候',{icon: 16,time:false,shade:0.8});
            var actionUrl = $("#inputForm").attr("action");
            var formData = $("#inputForm").serialize();//序列化表格内容为字符串
            $.ajax({
                type:'post',
                url:actionUrl,
                data:formData,
                cache:false,
                dataType:'json',
                success:function(result){
                    setTimeout(function () {
                        top.layer.msg(result.msg);
                        parent.layer.closeAll();
                    }, 300);
                }
            });
            return false;
        })
    });
    //父窗口调用表单提交方法
    function saveForm(){
        $("button[type='submit']").click();
    }
</script>
<%}%>